package Baza;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Konfiguracja {
	
	private Properties prop = new Properties();
	private String filename = "settings.cfg";
	public Konfiguracja(){
		getConfig();
	}
	/**
	 * Metoda wczytuje konfigurację programu.
	 */
	private void getConfig(){
		InputStream is = null;
		try{
			File f = new File(filename);
			is = new FileInputStream(f);
		}catch(IOException e){
			is = null;
		}
		try{
			if(is == null){
				is = getClass().getResourceAsStream(filename);
			}
			prop.load(is);
		}catch(Exception e){	}
		
	}
	
	
		
		
	public String getAppTitle(){
		return prop.getProperty("app_title", "Apteka");
	}
	
	public String getAuthor(){
		return prop.getProperty("author", "Wojciech Leśniak z drobną pomocą Rafała Zbojaka");
	}
	
	public String getLoginButton(){
		return prop.getProperty("login_button", "Zaloguj");
	}
	
	public String getRegisterButton(){
		return prop.getProperty("register_button", "Zarejestruj");
	}
	
	public Integer getFieldWidth(){
		return Integer.parseInt(prop.getProperty("field_width", "136"));
	}
	
	public Integer getFieldHeight(){
		return Integer.parseInt(prop.getProperty("field_height", "20"));
	}
	
	public String getErrorMessage(){
		return prop.getProperty("error", "Blad");
	}
	
	public String getRegisterEmptyError(){
		return prop.getProperty("register_empty_error","Wypelnij wszystkie pola!" );
	}
	
	public String getNumberLetterTypeError(){
		return prop.getProperty("number_letter_type_error", ",musi skladac sie z liter i/lub liczb!");
	}
	
	public String getLoginField(){
		return prop.getProperty("login", "Login");
	}
	
	public String getPasswordField(){
		return prop.getProperty("password", "Haslo");
	}
	
	public String getAddressField(){
		return prop.getProperty("address", "Adres");
	}
	
	public String getEmailField(){
		return prop.getProperty("email", "Email");
	}
	
	public String getEmailTypeError(){
		return prop.getProperty("email_type_error", "Nieprawidlowy adres email");
	}
	
	public String getNameField(){
		return prop.getProperty("name", "Imie");
	}
	
	public String getSurnameField(){
		return prop.getProperty("surname", "Nazwisko");
	}
	
	public String getPeselField(){
		return prop.getProperty("pesel", "Pesel");
	}
	
	public String getPhoneField(){
		return prop.getProperty("phone", "Telefon");
	}
	
	public String getLetterTypeError(){
		return prop.getProperty("letter_type_error", "musi skladac sie z samych liter");
	}
	
	public String getLoginExistError(){
		return prop.getProperty("login_exists", "Podany login jest zajety");
	}
	
	public String getPeselExistError(){
		return prop.getProperty("pesel_exists", "Uzytkownik o takim peselu juz ma konto");
	}
	
	public String getEmployeeField(){
		return prop.getProperty("worker_checkbox", "Pracownik");
	}
	
	public String getLoginError(){
		return prop.getProperty("login_error", "Nieprawidlowe dane logowania");
	}
	
	public String getLoggedOnField(){
		return prop.getProperty("logged_on", "Zalogowano:");
	}
	
	public String getFileMenuField(){
		return prop.getProperty("file_menu", "Plik");
	}
	
	public String getLogoutField(){
		return prop.getProperty("logout", "Wyloguj");
	}
	
	public String getAboutField(){
		return prop.getProperty("about", "O programie");
	}
	
	public String getExitField(){
		return prop.getProperty("exit", "Zamknij");
	}
	
	public String getEditField(){
		return prop.getProperty("edit", "Edycja");
	}
	
	public String getChangePasswordField(){
		return prop.getProperty("change_password", "Zmien haslo");
	}
	
	public String getAcceptButton(){
		return prop.getProperty("accept", "OK");
	}
	
	public String getCancelButton(){
		return prop.getProperty("cancel", "Anuluj");
	}
	
	public String getPasswordNewField(){
		return prop.getProperty("new_password", "Nowe Haslo");
	}
	
	public String getFarmaceutaNewField(){
		return prop.getProperty("new_employee", "Dodaj pracownika");
	}
	
	public String getJobField(){
		return prop.getProperty("job", "Stanowisko");
	}
	
	public String getDrugNewField(){
		return prop.getProperty("new_drug", "Dodaj lek");
	}
	
	public String getDrugNameField(){
		return prop.getProperty("drug_name", "Nazwa leku");
	}
	
	public String getDrugCostField(){
		return prop.getProperty("drug_cost", "Cena");
	}
	
	public String getDrugPathField(){
		return prop.getProperty("drug_path", "Nazwa pliku");
	}
	
	public String getDrugDescriptionField(){
		return prop.getProperty("drug_description", "Opis");
	}
	
	public String getDrugValidField(){
		return prop.getProperty("drug_date", "Data waznosci");
	}
	
	public String getDrugTypeField(){
		return prop.getProperty("drug_type", "Rodzaj recepty");
	}
	
	public String getAdminEnable(){
		return prop.getProperty("admin_enabled", "false");
	}
	
	public String getRefreshButton(){
		return prop.getProperty("refresh", "Odswiez");
	}
	
	public String getDrugPhotoField(){
		return prop.getProperty("photo", "Zdjecie");
	}
	
	public String getDrugShowField(){
		return prop.getProperty("show_drugs", "Lista lekow");
	}
	
	public String getEmployeesShowField(){
		return prop.getProperty("show_employees", "Lista Pracownikow");
	}
	
	public String getStatusField(){
		return prop.getProperty("status", "Status");
	}
	
	public String getUnavailable(){
		return prop.getProperty("unavailable", "Niedostepny");
	}
	
	public String getAvailable(){
		return prop.getProperty("available", "Dostepny");
	}
}
